home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software Vault: The Diamond Collection
/
The Diamond Collection (Software Vault)(Digital Impact).ISO
/
cdr08
/
addcli.zip
/
ADDCLIP.CLW
next >
Wrap
Text File
|
1995-03-11
|
9KB
|
276 lines
PROGRAM
omit('!@')
----------------------------------------------------------------------
This program will add the contents of the Windows(tm) clipboard
when those contents have been copied or cut from a column of numbers
such as might be found in an MS WinWord Table or a word processing
document.
Step one: highlight and copy (or cut) to the clipboard with CTRL-C or
CTRLX a column of figures for example:
1.34
23.1
129
8
123.91
Alignment isn't important.
Step two: Start this "Add Clip Board" program. Press the paste button
and your column of figures will appear in the left hand list followed
by an underline and a total.
If you need to do any sub totalling, numbers from the left hand list can
be dragged and dropped into the right hand list and vice versa.
Finally: Your total can be copied back into the clipboard by pressing
the copy button on either list.
On returning to your application, press CTRL-V to paste the result.
---------------------------------------------------------------------
Gus M. Creces
631 CloverPark Crescent
Milton, ON, L9T 4T7 Canada
(905) 878-5174 CIS-72073,1724
---------------------------------------------------------------------
!@
include('keycodes.clw') !Clarion standard keyboard constants
include('equates.clw') !Clarion standard program constants
include('errors.clw') !Clarion standard error constants
ClipID equate('CLIPLIST')
SubID equate('SUBLIST')
ProgramName equate('Add Clip Board')
UnderLine equate('====================')
Cr_Lf equate('<13><10>')
Total Real
ClipBd string(512)
SubTtl real
ClipChoice long
SubChoice long
MessageString string(1050)
ClipTable queue,pre(CT)
string(20)
end
SubTable queue,pre(ST)
string(20)
end
Window WINDOW(ProgramName),AT(38,25,193,108),FONT('Arial',8,,FONT:regular),ICON('CLIPBD.ICO'),STATUS, |
SYSTEM,GRAY,DOUBLE,AUTO
TOOLBAR,AT(0,0,193,12)
BUTTON('E&xit'),AT(9,1,22,10),FONT('Arial',0,,),MSG('Exit: '),USE(?ExitButton),SKIP
BUTTON('&Help'),AT(33,1,22,10),FONT('Arial',0,,),MSG('How to use: '),USE(?HelpButton),SKIP
END
GROUP,AT(2,1,91,92),USE(?ClipGroup),BOXED
LIST,AT(23,14,65,76),FONT('Arial',8,,),USE(?ClipList),NOBAR,VSCROLL,FORMAT('21R(1)~Clip Board~L@s20@'), |
FROM(ClipTable),DRAGID(ClipID),DROPID(SubID)
BUTTON('Read'),AT(4,14,16,12),MSG('Reread contents of clipboard.'),KEY(CtrlV),USE(?ClipReadButton), |
SKIP,ICON(ICON:Paste)
BUTTON('Copy'),AT(4,29,16,12),MSG('Copy the highlighted entry to the clipboard.'),USE(?ClipCopy), |
SKIP,ICON(ICON:Copy)
BUTTON('Cut'),AT(4,44,16,12),MSG('Cut the highlighted list entry.'),USE(?ClipCut),SKIP,ICON(ICON:Cut)
BUTTON('Clr'),AT(4,60,16,12),MSG('Clear the "Clipboard" list.'),USE(?ClipClear),SKIP,ICON(ICON:VCRrewind)
END
GROUP,AT(97,1,91,92),USE(?SubGroup),BOXED
LIST,AT(119,14,65,76),FONT('Arial',8,,),USE(?SubList),NOBAR,VSCROLL,FORMAT('21R(1)~SubTotals~L@s20@'), |
FROM(SubTable),DRAGID(SubID),DROPID(ClipID)
BUTTON('Copy'),AT(100,14,16,12),MSG('Copy the highlighted entry to the clipboard.'),USE(?SubCopy), |
SKIP,ICON(ICON:Copy)
BUTTON('Cut'),AT(100,29,16,12),MSG('Cut the highlighted list entry.'),USE(?SubCut),SKIP,ICON(ICON:Cut)
BUTTON('Clr'),AT(100,43,16,12),MSG('Clear the "Subtotal" list.'),USE(?SubClear),SKIP,ICON(ICON:VCRrewind)
END
END
MAP
TotalQueue(*Queue)
InitQueue(*Queue)
AddUnderLine(*Queue)
END
CODE
InitQueue(ClipTable)
InitQueue(SubTable)
OPEN(Window)
ACCEPT
CASE event()
OF Event:Drag
if DragID() = ClipID
get(ClipTable,choice())
SetDropID(ClipID)
elsif DragID() = SubID then
get(SubTable,choice())
SetDropID(SubID)
end
OF Event:Drop
if DropID() = ClipID then
SubTable = ClipTable
if not instring('==',SubTable,1,1) then
add(SubTable,1)
TotalQueue(SubTable)
end
elsif DropID() = SubID then
ClipTable = SubTable
if not instring('==',ClipTable,1,1) then
add(ClipTable,1)
TotalQueue(ClipTable)
end
end
END
if inrange(field(),?ClipGroup,?ClipClear) and not ClipChoice then
ClipChoice = true
SubChoice = false
select(?ClipList,1)
cycle
end
if inrange(field(),?SubGroup,?SubClear) and not SubChoice then
ClipChoice = false
SubChoice = true
select(?SubList,1)
cycle
end
CASE accepted()
OF ?ClipList
if keycode() = mouseleft then
ClipChoice = choice()
end
OF ?SubList
if keycode() = mouseleft then
SubChoice = choice()
end
OF ?ClipCut
if inrange(ClipChoice,1,records(ClipTable) - 1) then
get(ClipTable,ClipChoice)
delete(ClipTable)
end
TotalQueue(ClipTable)
OF ?SubCut
if inrange(SubChoice,1,records(SubTable) - 1) then
get(SubTable,SubChoice)
delete(SubTable)
end
TotalQueue(SubTable)
OF ?ClipClear
InitQueue(ClipTable)
OF ?SubClear
InitQueue(SubTable)
OF ?ClipCopy
if ClipChoice then
get(ClipTable,ClipChoice)
setclipboard(clip(left(ClipTable)) & Cr_Lf)
end
OF ?SubCopy
if SubChoice then
get(SubTable,SubChoice)
setclipboard(clip(left(SubTable)) & Cr_Lf)
end
OF ?ClipReadButton
ClipBd = ClipBoard()
free(ClipTable)
Total = 0
s# = 1
e# = instring(Cr_Lf,ClipBd,1,1)
if not e# and clip(ClipBd) > '' then
e# = len(Clip(ClipBd)) + 1
end
loop while e#
SubTtl = deformat(clipbd[s#:e#])
if SubTtl > 0 then
ClipTable = format(SubTtl,@N20.2)
add(ClipTable)
end
s# = e# + 2
e# = instring(Cr_Lf,clipbd,1,s#)
end
AddUnderLine(ClipTable)
TotalQueue(ClipTable)
OF ?ExitButton
break
OF ?HelpButton
MessageString = |
'This program reads numerical entries into a list from the ' & |
Cr_Lf & 'Windows(tm) clip board and adds them up. Any entry in ' & |
Cr_Lf & 'the "Clip Board" list may be dragged into the ' & |
Cr_Lf & '"Sub Total" list which then automatically re-totals. '&|
Cr_Lf & 'Several columns of discontinuous numbers, thus, can '& |
Cr_Lf & 'be copied to the clipboard, and totalled. These totals'&|
Cr_Lf & 'can be dragged to the "Sub Total" list where they too may'&|
Cr_Lf & 'be separately totalled. Any entry in the "Sub Total" list '& |
Cr_Lf & 'may be dragged into the "Clip Board" list which then re-totals.' & Cr_Lf & |
Cr_Lf & 'The PASTE button "pastes" entries from the clipboard.'& Cr_Lf & |
Cr_Lf & 'The SCISSORS button cuts the highlighted entry from the '&|
Cr_Lf & 'list next to it. ' & Cr_Lf & |
Cr_Lf & 'The COPY button copies the highlighted entry'&|
Cr_Lf & 'to the clipboard, so that the end value derived may '&|
Cr_Lf & 'be pasted back into an orignating application such' & |
Cr_Lf & 'as MS WinWord.'& Cr_Lf & |
Cr_Lf & 'The REWIND button clears the list next to it. '& Cr_Lf &|
Cr_Lf & 'This program was written by ' & |
Cr_Lf & 'Gus M. Creces'& |
Cr_Lf & '631 CloverPark Crescent, Milton ON, L9T 4T7 Canada.' & |
Cr_Lf & '(905) 878-5174 CIS-72073,1724 '
d# = Message(clip(MessageString),ProgramName,ICON:Question)
..
Return
!----------------------------
TotalQueue Procedure(xQueue)
!----------------------------
CODE
loop 2 times
get(xQueue,records(xQueue))
delete(xQueue)
end
Total = 0
loop i# = 1 to records(xQueue)
get(xQueue,i#)
SubTtl = deformat(xQueue)
Total += Subttl
end
AddUnderLine(xQueue)
!-----------------------------
AddUnderline Procedure(xQueue)
!-----------------------------
CODE
xQueue = UnderLine
add(xQueue)
xQueue = format(Total,@N20.2)
add(xQueue)
!--------------------------------
InitQueue Procedure(xQueue)
!--------------------------------
CODE
free(xQueue)
xQueue = UnderLine
add(xQueue,1)
xQueue = format(0,@N20.2)
add(xQueue,2)